import {reactive} from "vue";
import type {DialogModel} from "@/type/DialogModel.ts";
//这个hocks定义了弹框组件需要用到的数据和方法
export default function useDialog() {
    //定义弹框默认属性
    const dialog = reactive<DialogModel>({
        title: '标题',
        width: 630,
        height: 280,
        visible: false
    })
    //关闭弹框
    const onClose = () => {
        dialog.visible = false
    }
    //确认
    const onConfirm = () => {
        dialog.visible = false
    }
    //显示
    const onShow = () => {
        dialog.visible = true
    }
    return {dialog, onClose, onConfirm, onShow}
}